<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <link rel="shortcut icon" href="../../src/images/bitbug_favicon.ico" type="image/x-icon">
  <meta name="keywords" content="your keywords">
  <meta name="description" content="your description">
  <meta name="author" content="author,email address">
  <meta name="robots" content="index,follow">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  <title>仁和区党群服务一号通暨群众意见受理中心</title>
  <link rel="stylesheet" href="../../src/css/base.css">
  <link rel="stylesheet" href="../../src/css/common.css">
  <link rel="stylesheet" href="../../src/css/tpl.css">
  <link rel="stylesheet" href="../../src/css/user_center.css">
  <link rel="stylesheet" href="../../src/css/Feedback.css">
    <script src="../../src/js/libs/es5-shim.min.js"></script>   <script src="../../src/js/libs/es5-sham.min.js"></script>    <script src="../../src/js/libs/json3.min.js"></script> </head>

<body>
  <div class="page">
    <div id="header">
    </div>
    <div class="menu-bar">
      <div class="container">
        <span>
        <span class="crumb-name">当前你的位置：</span>>
        </span>
        <span>
             <a href="../Home/Index.html">首页</a>>
      </span>
        <span>
        <a class="" href="">书记信箱</a>
      </span>
      </div>
    </div>

    <div class="mid_container clearfix">
      <div class="left_guide">
        <h1 class="left_guide_top_size">
          在线民声
        </h1>
        <div class="left_guide_decorate">
        </div>
        <div class="left_about_us">
          THE VOICE OF THE PEOPLE
        </div>
        <div class="left_white_about">
          <a href="Goldidea.html" class="left_white_bottom"><span class="left_cn_about_us">金点子</span></a>
        </div>
        <div class="left_white_about">
          <a href="Feedback.html" class="left_white_bottom"><span class="left_cn_about_us">建议意见</span></a>
        </div>
        <div class="left_white_about">
          <a href="Notice.html" class="left_white_bottom"><span class="left_cn_about_us">民生投诉</span></a>
        </div>
        <div class="left_white_about active">
          <a href="SJMailbox.html" class="left_white_bottom"><span class="left_cn_about_us">书记信箱</span></a>
        </div>
        <div class="left_white_about">
          <a href="QZMailbox.html" class="left_white_bottom"><span class="left_cn_about_us">区长信箱</span></a>
        </div>
        <div class="left_white_about">
          <a href="Demanfar.html" class="left_white_bottom"><span class="left_cn_about_us">来件查询</span></a>
        </div>
      </div>
      <div class="mid_guide">
        <div class="mid_guide_content">
          <div class="content clearfix">
            <div class="sj_info fl clearfix">
              <div class="fl sj_info_l">
                <img src="../../src/images/gdz-7.png" alt="">
                <span>书记：任礎军</span>
              </div>
              <div class="fl sj_info_r">
                <h3>书记寄语：</h3>
                <p>领导寄语：倾听群众心声，把握仁和脉动，引导政风民情，服务科学发展。感谢大家来访，欢迎大家为我们建言献策，共同创造攀枝花人的幸福生活！</p>
                <a href="javascript:;" onclick="isLogin('AddLetters.html?3')" class="sj_letter_btn">我要写信</a>
              </div>
            </div>
            <div class="sj_stat fl">
              <h3>已办结信件统计</h3>
              <div class="sj_stat_table" id="email_html">

              </div>
            </div>
            <div class="fl" style="margin:30px 0;" id="table_html">

            </div>
            <div id="page1" class="laypage"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div id="footer">
  </div>
  <script id="table_tpl" type="text/html">
    <table class="other_table">
      <tbody>
        <tr class="tr-tit">
          <th>信件标题</th>
          <th style="width:90px">信件类型</th>
          <th style="width:90px">来信人</th>
          <th style="width:90px">来信日期</th>
          <th style="width:90px">状态</th>
          <th style="width:90px">评价</th>
        </tr>
        {{each resultdata val idx}}
        <tr>
          <td class="tl">
            <div class="td_1 fof"><a href="../Feedback/LetterDetail.html?{{val.id}}">{{val.title}}</a></div>
          </td>
          <td class="tc">{{val.appealtype | _appealtype}}</td>
          <td class="tc">{{val.username}}</td>
          <td class="tc">{{val.createtime.split(' ')[0]}}</td>
          <td class="tc">{{val.status | _status}}</td>
          <td class="tc">{{val.score | _score}}</td>
        </tr>
        {{/each}}

      </tbody>
    </table>

  </script>
  <script id="email_tpl" type="text/html">
    <div class="fl item title">
      <span>信件统计</span>
      <span>回复/总数</span>
    </div>
    <div class="fl item title">
      <span>信件统计</span>
      <span>回复/总数</span>
    </div>
    <div class="fl item">
      <span>信件总数</span>
      <span>{{count}}</span>
    </div>
    {{each resultdata val idx}}
    <div class="fl item">
      <span>{{val.appealtype | _appealtype}}</span>
      <span>{{val.feedback}}/{{val.total}}</span>
    </div>
    {{/each}}
  </script>
  <script src="../../src/js/libs/jquery.1.12.4.js"></script>
  <script src="../../src/js/libs/template-web.js"></script>
  <script src="../../src/js/libs/laypage/laypage.js"></script>
  <script src="../../src/js/base/common.js"></script>
  <script>
    var params = {
      page: 1
    }

    var pageindex = 4

    getList(params.page)

    $.ajax({
      url: "http://221.10.2.222:5680/api/ow/Complain/Letter/Num/",
      type: "GET",
      dataType: "json",
      data: {
        'source': 5,
        'type': 2
      },
      success: function (res) {
        res.resultdata = JSON.parse(res.resultdata)
        res.count = countTotal(res.resultdata)
        var email = template('email_tpl', res)
        $('#email_html').html(email)
      }
    })

    function getList(page) {
      $.ajax({
        url: "http://221.10.2.222:5680/api/ow/Complain/Letter/List/",
        type: "GET",
        dataType: "json",
        data: {
          'ispublic': 1,
          'source': 5,
          'page': page,
          'pagesize': 10
        },
        success: function (res) {
          res.resultdata = JSON.parse(res.resultdata)
          console.log(res)
          var table = template('table_tpl', res)
          $('#table_html').html(table)
          laypage({
            cont: 'page1',
            pages: Math.ceil(res.count / 10),
            curr: page || 1,
            first: false,
            last: false,
            prev: '<',
            next: '>',
            jump: function (obj, first) {
              // window.scrollTo(0, 0)
              if (!first) {
                getList(obj.curr);
              }
            }
          });
        }
      })
    }

    function countTotal(data) {
      var len = data.length,
        sum = 0
      while (len--) {
        sum += data[len]['total']
      }
      return sum
    }
    template.defaults.imports._appealtype = function (val) {
      var arr = ['投诉', '监督', '举报', '曝光', '表扬', '建议', '其他']
      val = parseInt(val) - 1
      return arr[val] ? arr[val] : '其他'
    };

    template.defaults.imports._status = function (val) {
      var arr = ['待处理', '待审核', '处理中', '待评价', '已完结', '已取消', '网格化管理员待处理', '网格化管理员已处理', '审核失败']
      val = parseInt(val) - 1
      return arr[val] ? arr[val] : '其他'
    };

    template.defaults.imports._score = function (val) {
      var arr = [, '基本满意', '不满意']
      val = parseInt(val) - 1
      return arr[val] ? arr[val] : '满意'
    };
  </script>
</body>

</html>